package com.nine.controller;

import com.nine.entity.Menu;
import com.nine.entity.MyReturn;
import com.nine.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * @author ：Fmc
 * @date ：Created in 2022/6/27 16:12
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("login")
public class LoginController {
    @Autowired
    private MenuService menuService;

    MyReturn myReturn = new MyReturn();

    @RequestMapping("login.do")
    public MyReturn login(HttpSession httpSession, String userName){
        Map<String, List<Menu>> menuMap = menuService.findAllMenuByUserName(userName);
        httpSession.setAttribute("menuMap",menuMap);
        myReturn.setCode(0);
        myReturn.setMsg("登陆成功");
        return myReturn;
    }
}
